% sample3D.m
% created 05/02/2013
% Crown copyright
%
% Description: Returns downsampled version of input matrix
%
% @author Kevin O'Holleran <kevin.o-holleran@npl.co.uk>
%
% @param A - 3D matrix
% @param n - downsample ratio vector (one index for each dimension)
%
% @return result - matrix
function [ downA ] = sample3D( A, n )

[d1 d2 d3] = size(A);
downA = A(1:n(1):d1,:,:);
downA = downA(:,1:n(2):d2,:);
downA = downA(:,:,1:n(3):d3);

end

